<template>
  <nav class="navigation">
    <div class="nav-container">
      <h1>房屋出租商城</h1>
      <div class="nav-links">
        <router-link to="/" class="nav-link" :class="{ active: $route.name === 'Home' }">
          首页
        </router-link>
        <router-link to="/user" class="nav-link" :class="{ active: $route.name === 'UserHome' }">
          用户界面
        </router-link>
        <router-link to="/admin" class="nav-link" :class="{ active: $route.name === 'AdminPanel' }">
          管理界面
        </router-link>
      </div>
    </div>
  </nav>
</template>

<script>
export default {
  name: 'Navigation'
}
</script>

<style scoped>
.navigation {
  background-color: #f8f9fa;
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.nav-container h1 {
  color: #2c3e50;
  margin: 0;
  padding: 15px 0;
}

.nav-links {
  display: flex;
}

.nav-link {
  padding: 15px 20px;
  text-decoration: none;
  color: #2c3e50;
  font-weight: 500;
  transition: color 0.3s;
}

.nav-link:hover {
  color: #42b983;
}

.nav-link.active {
  color: #42b983;
  border-bottom: 2px solid #42b983;
}
</style>